
#ifndef TEXT_ELEMENT_H
#define TEXT_ELEMENT_H

// INCLUDES ********************************************************************

#include "Color.h"

#include "Datatypes.h"

#include "Drawable.h"

#include "FontCache.h"

// FORWARD DECLARATIONS ********************************************************

/*******************************************************************************
 
 TODO: - alignment?
 
*******************************************************************************/

// *****************************************************************************

//! TextElement
//! 
//! Class handling display of text.

// *****************************************************************************

namespace Meteor 
{
    class TextElement : public Drawable
    {
         public:
            TextElement();
            
            TextElement( const std::string& fontname, 
                         const int fontSize = 12);
            
            TextElement( const std::string& fontname, 
                         const uint32_t zIndex, 
                         const int fontSize = 12);
            
            ~TextElement();
            
            //! font
            void SetFont( FTFont* const font);
        
            void SetFont( std::string& fontname);
            
            const FTFont* Font() const;
            
            //! fontsize
            void SetFontSize( const int fontSize);
            
            const int FontSize() const;
                
            //! text value
            void SetText( const std::string& text);
        
            const std::string& Text() const;
        
            //! the text color used
            void SetColor( const float red, const float green, 
                           const float blue, const float alpha);
        
            void SetColor( const Color& color);
        
            const Color& Color() const;
        
            //! text alignment
            void SetAlignment( const TextAlignment alignment);
            
            const TextAlignment Alignment() const;
            
            //! update/draw cycles
            void Update( const float deltaTime);
            
            void Draw() const;
    
        private:
            //! font used for this text to display
            FTFont* mFont;
        
            std::string mFontName;
        
            //! the text displayed
            std::string mText;
            
            //! display size
            int mFontSize;
        
            //! font resoultion ( default is 72 dpi);
            int mFontResolution;

            //! the color used to draw the text
            class Color mColor;
        
            //! the alignment
            TextAlignment mAlignment;

    }; // end of class TextElement

} // end of namespace Meteor

#endif // TEXT_ELEMENT_H
